import http from './http'


//获取验证码
export const getPhoneCode = (phone) => http('/api/getPhoneCode', {
  params: {
    phone
  }
});
//手机登录
export const phoneLogin = (phone, phoneCode) => http.post('/api/phoneLogin', {
  phone,
  phoneCode
});
//账号密码登录
export const pwdLogin = (userName, password, captcha) => http.post('/api/pwdLogin', {
  userName,
  password,
  captcha
});
//获取用户信息
export const getUserInfo = (userId) => http('/api/getUserInfo', {
  params: {
    userId
  }
});
//更新用户头像
export const updateUserAvatar = (userId, avatar) => http.post('/api/updateUserAvatar', {
  userId,
  avatar
});
//更新用户名
export const updateUserName = (userId, userName) => http.post('/api/updateUserName', {
  userId,
  userName
});
//更新用户性别
export const updateUserSex = (userId, sex) => http.post('/api/updateUserSex', {
  userId,
  sex
});
//更新用户生日
export const updateUserBirthday = (userId, birthday) => http.post('/api/updateUserBirthday', {
  userId,
  birthday
});
//更新用户签名
export const updateUserSign = (userId, sign) => http.post('/api/updateUserSign', {
  userId,
  sign
});
//上传图片到服务器
export const upLoadImg = (formData) => http.post('/api/admin/upLoadImg', formData);
//更新用户信息
export const updateUserInfo = (userId, userName, avatar, password, sex, sign, birthday) => http.post('/api/updateUserInfo', {
  userId,
  userName,
  avatar,
  password,
  sex,
  sign,
  birthday
});
//获取电影列表
export const getMovieList = () => http('/api/getMovieList');
//获取电影详情
export const getMovieDetail = (movieId) => http('/api/getMovieDetail', {
  params: {
    movieId
  }
});
//判断用户是否想看电影
export const isWishMovie = (userId, movieId) => http.post('/api/isWishMovie', {
  userId,
  movieId
});
//想看电影
export const wishMovie = (userId, movieId) => http.post('/api/wishMovie', {
  userId,
  movieId
});
//取消想看电影
export const cancelWishMovie = (userId, movieId) => http.post('/api/cancelWishMovie', {
  userId,
  movieId
});
//获取当前用户评论
export const getUserComment = (userId, movieId) => http('/api/getUserComment', {
  params: {
    userId,
    movieId
  }
});
//更新当前用户评论
export const updateUserComment = (userId, movieId, score, commentContent, commentDate) => http.post('/api/updateUserComment', {
  userId,
  movieId,
  score,
  commentContent,
  commentDate
});
//获取所有用户通过审核的评论
export const getAllUserPassComment = (movieId) => http('/api/getAllUserPassComment', {
  params: {
    movieId
  }
});
//获取当前评论
export const getCommentById = (commentId) => http('/api/getCommentById', {
  params: {
    commentId
  }
});
//更新当前评论的用户点赞
export const updateUserSupport = (commentId, supportNum, supportUser) => http.post('/api/updateUserSupport', {
  commentId,
  supportNum,
  supportUser
});
//获取电影列表
export const getCinemaList = () => http('/api/getCinemaList');
//获取当前影院详情
export const getCurrentCinemaDetail = (cinemaId) => http('/api/getCurrentCinemaDetail', {
  params: {
    cinemaId
  }
});
//获取当前影院的排片
export const getCurrentCinemaMovieSchedule = (cinemaId) => http('/api/getCurrentCinemaMovieSchedule', {
  params: {
    cinemaId
  }
});
//获取排片详情
export const getScheduleById = (scheduleId) => http('/api/getScheduleById', {
  params: {
    scheduleId
  }
});
//更新排片座位信息
export const updateScheduleSeat = (scheduleId, seatInfo) => http.post('/api/updateScheduleSeat', {
  scheduleId,
  seatInfo
});
//获取当前电影的排片
export const getCurrentMovieSchedule = (movieId) => http('/api/getCurrentMovieSchedule', {
  params: {
    movieId
  }
});
//根据名字模糊匹配电影
export const matchMovieByName = (movieName) => http('/api/matchMovieByName', {
  params: {
    movieName
  }
});
//根据名字模糊匹配影院
export const matchCinemaByName = (cinemaName) => http('/api/matchCinemaByName', {
  params: {
    cinemaName
  }
});
//用户下单
export const order = (userId, scheduleId, orderPhone, orderDate, ticketNum, totalPrice, orderSeatInfo, payType) => http.post('/api/order', {
  userId,
  scheduleId,
  orderPhone,
  orderDate,
  ticketNum,
  totalPrice,
  orderSeatInfo,
  payType
});
//获取个人订单信息
export const getOrderByUserId = (userId) => http('/api/getOrderByUserId', {
  params: {
    userId
  }
});
//获取个人想看电影
export const getWishMovieByUserId = (userId) => http('/api/getWishMovieByUserId', {
  params: {
    userId
  }
});
//获取个人评论的电影
export const getIsWatchedMovieByUserId = (userId) => http('/api/getIsWatchedMovieByUserId', {
  params: {
    userId
  }
});
